package com.isoft.dao.tabledao;

import com.isoft.entity.tableentity.dfme_gtls.DfmeGtlsDflt;
import com.isoft.entity.tableentity.dfme_gtls.DfmeGtlsGate;
import com.isoft.entity.tableentity.dfme_gtls.DfmeGtlsMeta;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.sql.Timestamp;

@Mapper
public interface DfmeGtlsDao {
    @Insert("insert into TEAM04.COMMON_META( create_time, sndr, rcvr, seqn, ddtm,type, styp) " +
            "values( #{create_time}, #{meta.sndr}, #{meta.rcvr}, #{meta.seqn}," +
            " #{meta.ddtm}, #{meta.type}, #{meta.styp})")
    public int insertMeta(@Param("create_time") Timestamp create_time,
                          @Param("meta") DfmeGtlsMeta dfmeGtlsMeta);


    @Insert("insert into TEAM04.DFME_GTLS(meta_id,create_time,flid,ffid,fide,fatt) " +
            "values(#{meta_id},#{create_time},#{dflt.flid},#{dflt.ffid},#{dflt.fide},#{dflt.fatt})")
    public int insertDflt(@Param("meta_id") int meta_id,
                          @Param("create_time") Timestamp create_time,
                          @Param("dflt") DfmeGtlsDflt dfmeGtlsDflt);

    @Insert("insert into TEAM04.DFME_GTLS_GTLS_GATE(meta_id,create_time,gtno,code,gtat,estr,eend,rstr,rend,btsc,gate_id) " +
            "values(#{meta_id},#{create_time},#{gate.gtno},#{gate.code},#{gate.gtat},#{gate.estr},#{gate.eend},#{gate.rstr},#{gate.rend},#{gate.btsc},#{gate.id})")
    public int insertGate(@Param("meta_id") int meta_id,
                          @Param("create_time") Timestamp create_time,
                          @Param("gate") DfmeGtlsGate dfmeGtlsGate);
}
